Filtering method for removing block artifacts and/or ringing noise and apparatus therefor

ABSTRACT

Provided are a filtering method and apparatus for removing blocking artifacts and ringing noise. The filtering method includes transforming video data on a block-by-block basis, and detecting the presence of an edge region in the video data by checking the distribution of values obtained by the transformation. Accordingly, it is possible to completely remove blocking artifacts and/or ringing noise by more effectively detecting the presence of an edge region in video data.

This is a continuation of U.S. application Ser. No. 13/419,880 filedMar. 14, 2012, which is a continuation of U.S. application Ser. No.12/364,994, filed Feb. 3, 2009 and to be issued as U.S. Pat. No.8,160,138 on Apr. 17, 2012, which is a continuation of U.S. applicationSer. No. 11/627,442, filed Jan. 26, 2007 and issued as U.S. Pat. No.7,630,437, which is a divisional application of U.S. application Ser.No. 10/354,164, filed Jan. 30, 2003 and issued as U.S. Pat. No.7,561,623, which claims the priority of Korean Patent Application Nos.2002-5742 and 2002-52457, filed 31 Jan. and 2 Sep., 2002, respectively,in the Korean Intellectual Property Office. The disclosures of each ofthe above-mentioned priority applications are incorporated herein intheir entirety by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to removing blocking artifacts and ringingnoise, and more particularly, to a filtering method and apparatus forremoving blocking artifacts and ringing noise caused when processing animage frame on a block-by-block basis.

2. Description of the Related Art

In general, video data is encoded by processing image frames in blockunits. In particular, according to video data encoding standards such asthe moving picture experts group standard (MPEG) and H.263, video datais encoded by performing a discrete cosine transform (DCT) andquantization on image frames in block units. However, encoding imageframes in block units may result in blocking artifacts and ringingnoise. Blocking artifacts make an edge region, which was not in theoriginal frame, occur in a reproduced image frame, thereby causingdiscontinuity between adjacent pixels of the edge region in thereproduced image frame. Also, when ringing noise occurs in an imageframe, a borderline of an object in the image frame is not smoothlydepicted, e.g., the borderline may be irregular. The higher acompression rate of the reproduced image frame, the more serious theblocking artifacts and the ringing noise become.

To filter the blocking artifacts and the ringing noise, it is importantto first find an exact region of the image frame in which the blockingartifacts and ringing noise occur. Otherwise, an edge region present inthe original image frame may be mistakenly regarded as being generateddue to the blocking artifacts and removed, thereby deteriorating thequality of the image.

In general, detection of an edge region of a pixel block reproduced dueto blocking artifacts and/or ringing noise is required to accomplish aconventional filtering method for removing blocking artifacts and/orringing noise. For instance, in a reproduced image frame consisting of aplurality of 8×8 or 4×4 pixel blocks, the distribution of pixel values,such as brightness, luminance, and color of pixels present on boundariesbetween the 8×8 or 4×4 pixel blocks are measured and the measured valuesare compared with a predetermined critical value. The critical value isexperimentally obtained by measuring the distribution of the above pixelvalues, such as brightness, luminance, and color of pixels, finding arelationship between the distributions of the above pixel values, anddetermining whether the edge region is present or not in an image frame.

To measure the distribution of pixel values, pixel values in a boundaryregion between adjacent blocks must be checked in the vertical orhorizontal direction. However, in fact, it is almost impossible to checkevery pixel value in the boundary region because of a large amount ofcalculation and complexity. In particular, since pixel values are storedin a memory device in the vertical direction in chronological order,continuous access to the memory device is required to calculate pixelvalues in the vertical direction. However, continuous access to a memorydevice is, at least for the time being, out of the question.

SUMMARY OF THE INVENTION

The present invention provides a filtering method and apparatus foreffectively detecting an edge region present in a pixel block.

The present invention also provides a filtering method and apparatus foreffectively detecting an edge region present in a pixel block with asmall amount of calculation.

According to an aspect of the present invention, there is provided afiltering method for removing blocking artifacts, including (a)transforming video data on a block-by-block basis; and (b) detecting thepresence of an edge region in the video data by checking thedistribution of values obtained by the transformation.

According to another aspect of the present invention, there is provideda filtering method for removing blocking artifacts, including (a)transforming and quantizing video data on a block-by-block basis; (b)creating filter information based on the distribution of values obtainedby the transformation and quantization; and (c) filtering the video databased on the filter information.

Preferably, (a) includes (a1) performing DCT on the video data on ablock-by-block basis to obtain DCT coefficients; and (a2) quantizing theDCT coefficients. More preferably, (a) includes performing DCT andquantization on a 4×4 pixel block to obtain a 4×4 quantized DCT block.

Preferably, (b) includes creating filter information indicating thedegree of the occurrence of blocking artifacts and/or ringing noisebased on the quantized DCT coefficients. More preferably, (b) comprises(b1) creating filter information by checking the values of pixels notcorresponding to a DC component, in the uppermost row of the quantizedDCT block, where the filter information indicates whether an edge regionis present in a vertical direction of the original pixel block.

Preferably, (b) also comprises (b2) creating filter information bychecking the values of pixels not corresponding to the DC component, inthe leftmost column of the quantized DCT block, where the filterinformation indicates whether an edge region is present in a horizontaldirection of the original pixel block. Otherwise, (b) may comprise (b3)creating filter information by checking the values of pixels not in theuppermost row and leftmost column of the quantized DCT block, where thefilter information indicates whether an edge region is present in adiagonal direction of the original pixel block.

Preferably, (b) comprises setting a vertical blocking flag (VBF) and ahorizontal blocking flag (HBF) to 1 as the filter information when onlythe pixel A has a value other than 0. Preferably, (c) comprisesdeblocking filtering more strongly in the horizontal and verticaldirections of the pixel block if the HBF and VBF are set to 1,respectively.

Preferably, (b) comprises setting the VBF to 1 as the filter informationwhen only the pixels A and B have values other than 0, and (c) comprisesdeblocking filtering more strongly in the vertical direction of thepixel block when the VBF is set to 1.

Preferably, (b) comprises setting the HBF to 1 as the filter informationwhen only the pixels A and C have values other than 0, and (c) comprisesdeblocking filtering more strongly in the horizontal direction of thepixel block when the HBF is set to 1.

Preferably, a ringing flag (RF) is set to 1 when the pixels A, B, and Chave values other than 0, and (c) comprises deringing filtering morestrongly when the RF is set to 1.

According to still another aspect of the present invention, there isprovided a filtering method for removing blocking artifacts, including(a) transforming and quantizing a block consisting of video data inpixel units so as to obtain quantized values, checking the obtainedquantized values, and creating filter information when the checkedresult is for filter information; and (b) performing filtering based onthe created filter information.

Preferably, (a) comprises (a1) performing DCT and quantization on one ofpixels not corresponding to a DC component, in the uppermost row andleftmost column of the block to obtain a quantized DCT coefficient; and(a2) checking the quantized DCT coefficient, creating filter informationbased on the checked result when the quantized DCT coefficient is avalue other than 0, and terminating performing DCT and quantization onthe pixels in the uppermost row and leftmost column.

(a) comprises (a3) checking the quantized DCT coefficient, andperforming DCT and quantization on one of pixels not corresponding tothe DC component, in the uppermost row and leftmost column when thequantized DCT coefficient is 0; (a4) repeatedly performing (a2) and (a3)on the remaining pixels not corresponding to the DC component and theone pixel, in the uppermost row and leftmost column so as to obtainquantized DCT coefficients; and (a5) creating filter information whenthe quantized DCT coefficients for all of the pixels in the uppermostrow and leftmost column are 0.

According to still another aspect of the present invention, there isprovided an encoder for encoding video data, comprising a loop filterwherein the loop filter comprises: a filter information producing unitwhich creates filter information based on the distribution of valuesobtained by transforming and quantizing a pixel block; a filtercharacteristics decision unit which determines filter characteristicsbased on the created filter information; and a deblocking filter whichdeblocking filters based on the determined filter characteristics.

Preferably, the loop filter further comprises a loop transforming unitwhich transforms pixel values for inter frame on a block-by-block basis,and a loop quantizing unit which quantizes values transformed by theloop transforming unit.

BRIEF DESCRIPTION OF THE DRAWINGS

The above objects and advantages of the present invention will becomemore apparent by describing in detail preferred embodiments thereof withreference to the attached drawings in which:

FIG. 1 is a block diagram of an encoding apparatus according to thepresent invention;

FIG. 2 is a block diagram of a loop filter according to a firstembodiment of the present invention;

FIGS. 3 and 4 are diagrams illustrating a method for producing filterinformation using a filter information producing unit according to afirst embodiment of the present invention;

FIG. 5 is a diagram illustrating filter information produced accordingto a modified one of the first embodiment of the present invention;

FIG. 6 is a flow chart illustrating a filtering method according to afirst embodiment of the present invention;

FIG. 7 is a flow chart illustrating another filtering method accordingto the first embodiment of the present invention;

FIG. 8 is a block diagram of a loop filter according to a secondembodiment of the present invention;

FIG. 9 is a diagram illustrating a method for obtaining filterinformation extraction data using a filter information producing unit,and a method for producing filter information based on the obtainedfilter information extraction data, according to a second embodiment ofthe present invention; and

FIG. 10 is a flow chart illustrating a filtering method according to asecond embodiment of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

For a better understanding of the present invention, the concept ofencoding video data will be briefly described before describingpreferred embodiments of the invention with reference to theaccompanying drawings.

In general, video data consists of a plurality of image frames. Imageframes are encoded into an intra frame and an inter frame and thentransmitted. The intra frame is encoded with no reference to otherimages and can be independently decoded. Meanwhile, the inter frame isencoded based on a previous or next image, that is, a difference betweenthe inter frame and the previous or next frame, and therefore, decodingof the inter frame requires the previous or next frame. Each image frameconsists of a plurality of macro blocks, and each macro block contains aplurality of pixel blocks.

In a filtering method and an encoding apparatus for performing themethod according to the present invention, an edge region is detected bytransforming a macro block or a pixel block and checking thedistribution of obtained transform values and/or values obtained byquantizing the transform values. A filtering method and an encodingapparatus for performing the method will now be described.

FIG. 1 is a block diagram of an encoding apparatus according to apreferred embodiment of the present invention. Referring to FIG. 1, theencoding apparatus includes a motion estimator 1, a transformer 2, aquantizer 3, an inverse quantizer 4, an inverse transformer 5, a motioncompensator 6, and a loop filter 7. The encoding apparatus furtherincludes a controller (not shown), a first switch 10, a second switch20, and a third switch 30, with all switches being controlled by thecontroller.

When video data is input to the controller, the controller controls thefirst switch 10 such that an intra frame and an inter frame are inputdirectly to the transformer 2 and the motion estimator 1, respectively.The motion estimator 1 compares a pixel value with a previous pixelvalue in pixel block units and outputs a difference, i.e., motionvector, between the pixel value and the previous pixel value, to thetransformer 2. The transformer 2 changes the descriptive manner of data,i.e., transforms, for pixel values present in an image frame in case ofthe intra frame, and the difference, i.e., motion vector, in case of theinter frame. In this embodiment of the present invention, discretecosine transform (DCT) is performed to transform image frames but anyapplicable method such as a discrete wavelet transform (DWT) may be usedinstead of the DCT. The quantizer 3 quantizes the transformed values,i.e., DCT coefficients, according to predetermined quantization step.The quantization step may be determined adaptively to the respectiveblock unit. However, the larger the size of the quantization step, themore noise due to quantization of values increases. Values, which areobtained by performing the DCT and quantization on an image frame, arecoded using variable-length coding (VLC), for example, and transmittedto a receiving end.

Meanwhile, the values, which are obtained by the DCT and quantization,are input to the inverse quantizer 4 or the loop filter 7. Also, thecontroller controls the second switch 20 to input intra frames to theloop filter 7 and inter frames only to the inverse quantizer 4. Morespecifically, in case of intra frames, values output from the quantizer3 are required to detect an edge region, that is, values obtained byperforming the DCT and quantization on pixels in block units. Therefore,the values can be input directly to the loop filter 7 without beingadditionally processed. In case of inter frames, values output from thequantizer 3 are obtained by performing the DCT and quantization ondifferences (motion vectors) between the inter frames and their previousframes. Thus, the values are input to the inverse quantizer 4 whoseoutput is input to the inverse transformer 5, to perform inversequantization and IDCT on pixels on a block-by-block basis, which is aprocess of restoring pixel values in block units.

The inverse quantizer 4 inversely quantizes the given pixel valuesaccording to a predetermined quantization step, and the inversetransformer 5 inversely transforms the inversely quantized values. Morespecifically, in this embodiment, the inverse transformer 5 performsinverse discrete cosine transform (IDCT) on the inversely quantizedvalues. However, in case that the transformer 2 adopts a transformmethod other than the DCT, the inverse transformer 5 performs theinverse transform based on the transform method, instead of IDCT. Forinstance, if the transformer 2 is set to perform discrete wavelettransform (DWT) on pixel values, the inverse transformer 5 performsinverse DWT (IDWT) thereon. Intra frames output from the inversetransformer 5 are pixel values to be filtered, i.e., pixel values of acurrent image frame, and thus are input to the loop filter 7. Interframes need to be compensated for their motion to obtain pixel valuesfor the current image frame, and thus inter frames are input to themotion compensator 6. Next, the controller controls the third switch 30to input the intra frames output from the inverse transformer 5 to theloop filter 7 and input the inter frames output from the inversetransformer 5 to the motion compensator 6. Then, the motion compensator6 adds the differences between the inter frames and a previous imageframe to the previous image frame in block units, restores the currentimage frame, and outputs the result to the loop filter 7.

The loop filter 7 filters image frames according to the presentinvention. According to a first embodiment of the present invention, theloop filter 7 checks the distribution of values obtained by performingDCT and quantization thereon to determine whether an edge region ispresent in an image frame, and filters the image frame according to thechecked result. According to a second embodiment of the presentinvention, the loop filter 7 checks values obtained by performing DCTand quantization on pixel values in the leftmost column and uppermostrow, respectively, so as to determine whether an edge region is presentin an image frame. Next, the loop filter filters the image frameaccording to the checked result. A detailed description of theoperations of the loop filter 7 will be described later.

FIG. 2 is a block diagram of the loop filter 7 according to the firstembodiment of the present invention. Referring to FIG. 2, the loopfilter 7 includes a loop transforming unit 71, a loop quantizing unit72, a filter information producing unit 73, a filter characteristicsdecision unit 74, a deblocking filter 75, and a deringing filter 76.

There are two types of data input to the loop filter 7: (i) object data{circle around (1)} to be filtered; and (ii) filter informationextraction data {circle around (2)} and {circle around (3)} to be usedto produce filter information. The object data {circle around (1)}refers to pixel values of image frames in block units. The object data{circle around (1)} of an intra frame is transmitted to the loop filter7 via the third switch 30, and that of an inter frame is input from themotion compensator 6 to the loop filter 7. In the first embodiment, thefilter information extraction data {circle around (2)} and {circlearound (3)} refer to values obtained by performing DCT and quantizationon pixel values of a certain block. The filter information extractiondata {circle around (2)} of an intra frame refers to values obtained byperforming DCT and quantization on pixel values on a certain block andis transmitted directly to the loop filter 7 via the second switch 20 soas to create filter information without an additional calculationprocess. However, the filter information extraction data {circle around(3)} of an inter frame is input to the loop filter 7 from the motioncompensator 6 and thus must be transformed and quantized within the loopfilter 7. For this reason, values input via the second switch 20, i.e.,the filter information extraction data {circle around (2)} of an intraframe, are input to the filter information producing unit 73, and thevalues input from the motion compensator 6, i.e., the filter informationextraction data {circle around (3)} of an inter frame, are input to theloop transforming unit 71.

The loop transforming unit 71 and the loop quantizing unit 72 transformsand quantizes pixel values on a block-by-block basis for an inter frame,respectively. The loop transforming unit 71 and the loop quantizing unit72 have the same functions, i.e., transformation and quantization, asthe transformer 2 and the quantizer 3 shown in FIG. 1. However, thetransformation and quantization of the loop transforming unit 71 and theloop quantizing unit 72 do not need the same precision as thetransformer 2 and the quantizer 3. This is because values produced bythe loop transforming unit 71 and the loop quantizing unit 72 are usedto only detect the occurrence of an edge region, and thus may have lowerprecision than those obtained by the transformer 2 and the quantizer 3to encode video data. Accordingly, the loop transforming unit 71 and theloop quantizing unit 72 may lower precision in DCT and quantization byusing integral operation instead of decimal operation, increasing thesize of quantization step, or performing a fast-mode DCT, therebyreducing the amount of calculation. For instance, a simplifiedquantization algorithm performed by the loop quantizing unit 72 is asfollows:

LEVEL=(K×A(QP)+f×2²⁰)2²⁰,

wherein LEVEL denotes a quantized value, K denotes a quantized pixelvalue on which DCT is performed, A(QP) denotes a constant from a mappingtable, and f is a constant determined depending on a target compressionefficiency. The quantized value is set to 1 if K<(2²⁰−f×2²⁰)/A(QP), andis set to another predetermined value otherwise.

The filtering information producing unit 73 creates filter informationwith values obtained by performing DCT and quantization on pixel valueson a block-by-block basis. A detailed description of the operation ofthe filtering information producing unit 73 will be described later. Thefilter characteristics decision unit 74 determines and outputs filtercharacteristics based on the filter information. The deblocking filter75 and the deringing filter 76 perform filtering on video data accordingto the determined filter characteristics.

FIGS. 3 and 4 are diagrams illustrating a method for creating filterinformation using the filter information producing unit 3 of FIG. 1,according to a first embodiment of the present invention. Referring toFIG. 3, DCT and quantization are performed on a 4×4 pixel block, whichis a basic unit in the first embodiment, to obtain a 4×4 quantized DCTblock (hereinafter, ‘DCT block’). In the DCT block, a denotes a DCcomponent pixel, b denotes pixels other than pixel a, in the uppermostrow of the DCT block that indicate whether an edge region is present inthe vertical direction of the DCT block, c denotes pixels other thanpixel a, in the leftmost column of the DCT block that indicate whetheran edge region is present in the horizontal direction of the DCT block,and d denotes pixels other than pixels a through c in the leftmostcolumn and uppermost row of the DCT block, which indicate the occurrenceof ringing noise in a diagonal direction of the DCT block.

In conclusion, filter information is created using the values of pixelsA through C, according to a preferred embodiment of the presentinvention, shown in FIG. 4. The presence or degree of blocking artifactsis determined by checking the values of the pixels A, B, and C andfilter information is created according to the checked result, asfollows:

(1) In the case where only pixel A has a value other than 0:

That is, if the pixels B and C are set to 0, all pixels of a pixelblock, which is to be reproduced at a receiving site, have the samevalues. In this case, there is very little probability that an edgeregion is present in the horizontal and vertical directions of theoriginal pixel block. Therefore, if an edge region is present in areproduced pixel block, it is regarded as being due to blockingartifacts, and thus, a horizontal vertical blocking flag (HBF) and avertical blocking flag (VBF) are set to 1 as filter information.

(2) In the case where only the pixels A and B have a value other than 0:

In this case, pixels in the vertical direction of a pixel blockreproduced at a receiving site, have the same value within apredetermined range. This means there is a probability that an edgeregion is present in the horizontal direction of the original pixelblock but there is very little probability that an edge region ispresent in the vertical direction of the original pixel block. That is,an edge region is present only in the vertical direction of thereproduced pixel block, which is considered as being due to the blockingartifacts. Therefore, the VBF is set to 1 as filter information.

(3) In the case where only the pixels A and C have a value other than 0:

In this case, pixels in the horizontal direction of a pixel blockreproduced at a receiving site, have the same values within apredetermined range. This means there is a probability that an edgeregion is present in the vertical direction of the original pixel blockbut there is very little possibility that an edge region is present inthe horizontal direction thereof. Therefore, if an edge region ispresent in the horizontal direction of the reproduced pixel block, it isregarded as being due to the blocking artifacts. In this case, the HBFis set to 1 as filter information.

(4) In the case where pixels other than pixels A, B, and C, have a valueother than 0:

If pixels in the rows and columns but not in the row where pixels A andB belong, and the column to which the pixels A and C belong, have avalue other than 0, a ringing flag RF is set to 1 as filter information.This means a ringing noise occurs in a reproduced pixel block.

When the HBF and/or the VBF, and the RF are transmitted to the filtercharacteristics decision unit 74, the filter characteristics decisionunit 74 determines filter characteristics based on these flags. In otherwords, if the HBF is determined, the deblocking filter 75 is set toperform filtering more strongly in the horizontal direction of a pixelblock. If the VBF is determined, the deblocking filter 75 is set toperform filtering more strongly in the vertical direction of the pixelblock. If the RF is set, the deringing filter 76 is set to performfiltering more strongly in the pixel block. Accordingly, it is possibleto perform adaptive filtering on video data according to the degree ofblocking artifacts and/or ringing noise.

In the first embodiment, filter information is created using the valuesof the pixels A, B, and C to remove blocking artifacts. Alternatively,it is possible to create filter information while skipping the step ofchecking at least one of the values of the pixels in the uppermost andleftmost columns according to the specifications of an applicationrelating to precision and rapidity.

FIG. 5 is a diagram illustrating filter information produced accordingto a modified example of the first embodiment of the present invention.Here, a loop filter 7 of FIG. 2 is used. However, the modified exampleof the first embodiment is different from the first embodiment in thatdiscrete wavelet transform (DWT), instead of DCT, is performed on imageframes.

Referring to FIG. 5, DWT and quantization are performed on a 4×4 pixelblock to obtain four 2×2 quantized DWT blocks e through h. The block eis obtained by passing the 4×4 DCT block, of FIG. 4, through a low-passfilter and corresponds to the DC component, i.e., pixel A, of the 4×4quantized DCT block. The block f corresponds to the pixel B of the 4×4quantized DCT block, i.e., it indicates whether an edge region ispresent in a horizontal direction of the original pixel block. The blockg corresponds to the pixel C of the 4×4 quantized DCT block, i.e., itindicates whether an edge region is present in a vertical direction ofthe original pixel block. The block h corresponds to other pixels not onthe uppermost and leftmost columns of the block to which the pixels Aand B, and pixels A and C belong, of the 4×4 quantized DCT block. Theblock h indicates whether ringing noise occurs in the original pixelblock.

In the first embodiment, filter information is created using the valuesof the pixels A, B, and C. Similarly, in the modified example of thefirst embodiment, filter information indicating the occurrence ofblocking artifacts and/or ringing noise is also created using the blockse, f, g, and h.

A filtering method according to the first embodiment of the presentinvention will now be described.

FIG. 6 is a flow chart illustrating a filtering method according to afirst embodiment of the present invention. Referring to FIG. 6, anencoder performs DCT on input video data on a block-by-block basis instep 601 to obtain DCT coefficients. Next, the DCT coefficients arequantized according to a predetermined quantization step to obtain aquantized DCT block in step 602. After step 602, the encoder checks thedistribution of values of pixels of the quantized DCT block in step 603,and creates filter information based on the checked result in step 604.With the filter information, it is possible to detect the degree ofblocking artifacts and/or ringing noise. After step 604, the encoderdetermines filter characteristics based on the created filterinformation and performs adaptive filtering on the input video data instep 605.

FIG. 7 is a flow chart illustrating another filtering method accordingto the first embodiment of the present invention. Referring to FIGS. 2and 7, in step 701, the filter information producing unit 73 checks thedistribution of values of pixels of a quantized DCT block, and sets ahorizontal blocking flag HBF, a vertical blocking flag VBF, or a ringingflag RF to 1 or 0. If the HBF is set to 1 in step 702, the filtercharacteristics decision unit 74 determines filter characteristics suchthat the deblocking filter 75 performs filtering more strongly in thevertical direction of the DCT block, in step 703. If the VBF is set to 1in step 704, the filter characteristics decision unit 74 determines andoutputs filter characteristics such that the deblocking filter 75performs filtering more strongly in the horizontal direction of the DCTblock, in step 705. If the HBF and the VBF are set to 1 in step 706, thefilter characteristics decision unit 74 determines filtercharacteristics such that the deblocking filter 75 performs filteringmore strongly in the vertical and horizontal directions of the DCTblock, in step 707. If the RF is set to 1 in step 708, the filtercharacteristics decision unit 74 determines filter characteristics suchthat the deringing filter 76 performs filtering more strongly on the DCTblock, in step 709. Thereafter, the deblocking filter 75 and thederinging filter 76 perform adaptive filtering on input video dataaccording to the set filter characteristics, in step 710.

Deblocking filtering is performed on a block-by-block basis, but videodata is in fact input to the encoder together with pixel values atborder regions of blocks adjacent to a current block as well as thecurrent block. The input pixel values are filtered by the deblockingfilter 75 and outputs as changed values. For instance, adjacent values 3through 6 are changed when pixel values 1 through 4 of the current blockand pixel values 5 through 8 of the adjacent block are more stronglyfiltered by the deblocking filter 75, and only the values 4 and 5 arechanged otherwise. Accordingly, a flag of an adjacent block is comparedwith that of a current block to adjust the characteristics value of thedeblocking filter 75. That is, the filter characteristics value of thedeblocking filter 75 is set to a strong value if the flag of theadjacent block is the same as that of the current block and set to aweak value otherwise.

Alternatively, the filter information producing unit 73 may compare theflags VBF, HBF, and RF of the adjacent blocks with the flags VBF, HBF,and RF of the current block, and create filter information based on thecompared result. As a result, the created filter information can be moreaccurately expressed than the filter information created using flags ofthe current block, and thus, filter characteristics values can be moreprecisely determined.

FIG. 8 is a block diagram of the loop filter 2 according the secondembodiment of the present invention. Referring to FIG. 8, the loopfilter 7 includes a loop transforming unit 81, a loop quantizing unit82, a filter information producing unit 83, a filter characteristicsdecision unit 74, a deblocking filter 75, and a deringing filter 76.

There are two types of data input to the loop filter 7: (i) object data{circle around (1)} to be filtered; and (ii) filter informationextraction data {circle around (2)} and {circle around (3)} to be usedto produce filter information. The object data {circle around (1)}refers to pixel values of image frames in block units. The object data{circle around (1)} of an intra frame is transmitted to the loop filter7 via the third switch 30, and that of an inter frame is input from themotion compensator 6 to the loop filter 7. As in the second embodiment,the filter information extraction data {circle around (2)} and {circlearound (3)} refer to values obtained by performing DCT and quantizationon pixel values of a certain block. In case of the filter informationextraction data {circle around (2)} of an intra frame refers to valuesobtained by performing DCT and quantization on pixel values on a certainblock and is transmitted directly to the loop filter 7 via the secondswitch 20 so as to create filter information without an additionalcalculation process. However, the filter information extraction data{circle around (3)} of an inter frame is input to the loop filter 7 fromthe motion compensator 6 and thus must be transformed and quantizedwithin the loop filter 7. For this reason, values input via the secondswitch 20, i.e., the filter information extraction data {circle around(2)} of an intra frame, are input to the filter information producingunit 83, and the values input from the motion compensator 6, i.e., thefilter information extraction data {circle around (3)} of an interframe, are input to the loop transforming unit 71.

The loop transforming unit 81 performs DCT or DWT on first and secondpixels in the uppermost row and leftmost column of a predetermined sizedblock of an input inter frame, respectively. In this case, DCT or DWT isperformed on the first and second pixels of the leftmost columndownward, and performed on the first and second pixels of the uppermostrow from the left to the right. The loop quantizing unit 82 quantizesDCT coefficients transformed by the loop transforming unit 81. The DCTand quantization of the loop transforming unit 81 and the loopquantizing unit 82 are the same as the transformer 2 and the quantizer 3described with reference to FIG. 1. However, the transformation andquantization of the loop transforming unit 81 and the loop quantizingunit 82 do not need the same precision as the transformer 2 and thequantizer 3. This is because values produced by the loop transformingunit 81 and the loop quantizing unit 82 are used to only detect theoccurrence of an edge region, and thus may have lower precision thanthose obtained by the transformer 2 and the quantizer 3 to encode videodata. Accordingly, the loop transforming unit 81 and the loop quantizingunit 82 may have lower precision in DCT and quantization by usingintegral operation instead of decimal operation, increasing the size ofquantization step, or performing a fast-mode DCT, thereby reducing theamount of calculation. For instance, an example of a simplifiedquantization algorithm performed by the loop quantizing unit 82 is asfollows:

LEVEL=(K×A(QP)+f×2²⁰)2²⁰,

wherein LEVEL denotes a quantized value, K denotes a quantized pixelvalue on which DCT is performed, A (QP) denotes a constant from amapping table, and f is a constant determined depending on a targetcompression efficiency. The quantized value is set to 1 ifK<(2²⁰−f×2²⁰)/A(QP), and is set to another predetermined valueotherwise.

The filter information producing unit 83 checks if the first and secondpixels in each of the leftmost and uppermost rows, on which DCT (or DWT)and quantization are performed, have values other than 0. If the DCT (orDWT) or quantized second pixel value in the leftmost or uppermost row is0, the filter information producing unit 83 instructs the looptransforming unit 81 and the loop quantizing unit 82 to perform DCT (orDWT) on and quantize a next pixel, respectively. The filter informationproducing unit 83 receives a value of the next pixel and checks if thevalue is 0 and repeats the aforementioned operation.

If the value which is obtained by performing DCT (or DWT) or quantizingthe second pixel value in the leftmost or uppermost row is a value otherthan 0, the filter information producing unit 83 creates filterinformation based on the result. A method for creating filterinformation is as described in the first embodiment. Next, the filterinformation producing unit 83 instructs the loop transforming unit 81and the loop quantizing unit 82 to stop performing DCT (or DWT) andquantizing a pixel value, respectively. In other words, if the value isnot 0, DCT (or DWT) and quantization of pixel values in the leftmostcolumn or uppermost row are terminated (a detailed description thereofwill be later described). The filter characteristics decision unit 74determines and outputs filter characteristics based on the filterinformation. The deblocking filter 75 and the deringing filter 76perform filtering according to the determined filter characteristics.The operations of the filter characteristics decision unit 74, thedeblocking filter 75, and the deringing filter 76 are the same as thoseof the filter characteristics decision unit 74, the deblocking filter75, and the deringing filter 76 according to the first embodiment.Therefore, their descriptions will be omitted here.

FIG. 9 is a diagram illustrating a method for obtaining filterinformation extraction data using the filter information producing unit83 of FIG. 8 and creating filter information from the filter informationextraction data, according to the second embodiment of the presentinvention. In the filtering method of FIG. 9, DCT and quantization areperformed on a first pixel C, which is indicated with dotted lines in(a), adjacent to a DC component A in the leftmost column of a 4×4 pixelblock which is a basic unit for filtering in the present invention.Next, a value obtained by DCT and quantization is checked. If the valueis not 0, DCT and quantization are terminated and filter information iscreated based on the checked result. If the value is 0, DCT andquantization are performed on a second pixel C, which is indicated withdotted lines in (b), to obtain other values. If the other value is not0, DCT and quantization are terminated and filter information is createdon the checked result. However, if the other value is 0, DCT andquantization are performed on a third pixel C, which is indicated withdotted lines in (c), and then, it is also checked to still another valueobtained by DCT and quantization. Likewise, if the still another valueis not 0, DCT and quantization are terminated and filter information iscreated based on the checked result. If the still another value is 0 andthere are no more pixels in the leftmost column, filter information iscreated based on the results already obtained. Filter information isobtained as described in the method according to the first embodiment ofthe present invention.

Meanwhile, DCT and quantization are performed on a first pixel B,adjacent to the DC component A, in the uppermost row of the 4×4 pixelblock, indicated with dotted lines in (d). Next, it is checked with avalue obtained by DCT and quantization. If the value is not 0, DCT andquantization are terminated and filter information is created based onthe checked result. If the value is 0, DCT and quantization areperformed on a second pixel B, which is indicated with dotted lines in(e), and then, it is checked with other value obtained by DCT andquantization. If the other value is not 0, DCT and quantization areterminated and filter information is created on the checked result. Ifthe other value is 0, DCT and quantization are performed on a thirdpixel, which is indicated with dotted lines in (f), and it is checkedwith a still another value. If the still another value is not 0, DCT andquantization are terminated and filter information is created on thechecked result. However, if the still another value is 0 and there areno more pixels, in the uppermost row, filter information is createdbased on the results already obtained. Filter information is created asdescribed in the method according to the first embodiment of the presentinvention.

Likewise, DCT and quantization are performed on pixels other than A, B,and C of the 4×4 pixel block on a block-by-block basis. Next, a valueobtained by DCT and quantization is checked to detect the occurrence ofringing noise. Thereafter, filter information is created based on acriteria for determining the occurrence of ringing noise and theoccurrence of the ringing noise. A method for creating filterinformation is the same as that according to the first embodiment of thepresent invention.

FIG. 10 is a flow chart illustrating a filtering method according to thesecond embodiment of the present invention. Referring to FIG. 10, DCTand quantization are performed on a first pixel, adjacent to a DCcomponent, in the leftmost column of a 4×4 pixel block, in order tocalculate a quantized DCT coefficient, in step 1001. After step 1001,the calculated quantized DCT coefficient is checked in step 1002. If thequantized DCT coefficient is 0, DCT and quantization are performed on anext pixel in step 1003, and it proceeds to step 1002.

However, if the quantized DCT coefficient is a value other than 0 or arelated pixel is the last pixel in the leftmost column, DCT andquantization are terminated and filter information is created on theresults already obtained, in step 1004. That is, when any pixel in theleftmost column has a quantized DCT coefficient other than 0, horizontalblocking flag (HBF) is set to 1 as filter information.

After step 1004, DCT is performed on a first pixel, adjacent to the DCcomponent, in the uppermost row, and an obtained DCT coefficient isquantized to calculate a quantized DCT coefficient, in step 1005. Next,the calculated quantized DCT coefficient is checked in step 1006. If thequantized DCT coefficient is 0, DCT and quantization are performed on anext pixel in step 1007, and it proceeds to step 1006.

When the quantized DCT coefficient is a value other than 0 or a relatedpixel is the last one in the uppermost row, DCT and quantization areterminated and filter information is created based on the resultsalready obtained, in step 1008. In other words, if any pixel in theuppermost row has a quantized DCT coefficient other than 0, a verticalblocking flag (VBF) is set to 1 as filter information.

After step 1008, DCT and quantization are performed on a pixel adjacentto the DC component, not in the uppermost row and leftmost column, instep 1009. Next, an obtained quantized DCT coefficient is checked instep 1010. If the quantized DCT coefficient is 0, DCT and quantizationare performed on a next pixel in step 1011, and it proceeds to step1010.

When the quantized DCT coefficient is a value other than 0 or a relatedpixel is the last one not in the leftmost column and uppermost row, DCTand quantization are terminated and filter information is created onresults already obtained in step 1012. That is, if any pixel, not in theleftmost column and uppermost row, has a quantized DCT coefficient otherthan 0, a ringing flag (RF) is set to 1 as filter information.

After step 1012, filter characteristics are determined based on thefilter information, and adaptive filtering is performed, in step 1013. Amethod for making the filter characteristics is as described withreference to FIG. 7. That is, when the HBF is set to 1, the filtercharacteristics decision unit 74 of FIG. 2 or 8 determines the filtercharacteristics such that the deblocking filter 75 of FIG. 2 or 8performs filtering more strongly in a vertical direction of a pixelblock. When the VBF is set to 1, the filter characteristics aredetermined such that the deblocking filter 75 performs filtering morestrongly in the vertical direction of a 4×4 pixel block. In case whereboth the HBF and VBF are set to 1, the filter characteristics decisionunit 74 determines and outputs the filter characteristics such that thedeblocking filter 75 performs filtering more strongly in the verticaland horizontal directions of the 4×4 pixel block. If the RF is set to 1,the filter characteristics are determined such that the deringing filter76 of FIG. 2 or 8 performs filtering more strongly on the 4×4 pixelblock. Then, the deblocking filter 75 and the deringing filter 76perform adaptive filtering according to the set filter characteristics.

Deblocking filtering is performed on a block-by-block basis, but videodata is in fact input to an encoder, together with pixel values atborder regions of blocks adjacent to a current block as well as thecurrent block. The input pixel values are filtered by the deblockingfilter 75 and outputs as changed values. For instance, pixel values 3through 6 are changed when pixel values 1 through 4 of the current blockand pixel values 5 through 8 of an adjacent block are more stronglyfiltered by the deblocking filter 75. However, if these pixel values areweakly filtered by the deblocking filter 75, only the values 4 and 5 arechanged. Accordingly, a flag of an adjacent block is compared with thatof a current block in order to adjust the filter characteristics of thedeblocking filter 75. That is, the filter characteristics value of thedeblocking filter 75 is set to a strong value when the flag of theadjacent block is the same as that of the current block and is set to aweak value otherwise, thereby obtaining relatively accurate filtercharacteristics values.

Alternatively, the filter information producing unit 73 may compare theflags VBF, HBF, and RF of the adjacent blocks with the flags VBF, HBF,and RF of the current block, and create filter information based on thecomparison result. As a result, the created filter information can beexpressed with more accurate values than the filter informationconsisting of flags of the current block. In this case, filtercharacteristics values can be more precisely determined.

In the filtering method of FIG. 10 according to the second embodiment,DCT and quantization are first performed on a plurality of pixels notcorresponding to the DC component, in the leftmost column of a pixelblock; a plurality of pixels not corresponding to the DC component, inthe uppermost row; and a pixel, not in the uppermost row and leftmostcolumn, adjacent to the DC component. However, alternatively, DCT andquantization may first be performed on one of the above pluralities ofpixels.

In comparison with the method according to the first embodiment, DCT andquantization are performed in units of pixels in the method according tothe second embodiment, thereby reducing the amount of calculation. Also,DWT, instead of DCT, may be performed on pixels in the method accordingto the second embodiment, as like in the method according to the firstembodiment.

Meanwhile, a loop filter of an encoder is used in performing thefiltering method in the first and second embodiments. However, thefiltering method may be implemented as a post filter in a decoder.

An example of a source code representing a filtering method according tothe present invention is as follows:

Info[0] = WEAK; if( (RF of current block == 0) && (RF of left block ==0) ) { if( HBF of current block == 1 ) Info[0] = STRONG;  else Info[0] =WEAK;  if( HBF of left block == 1 ) Info[1] = STRONG;  else Info[1] =WEAK;  if( HBF of left block == 1 ) Info[1] = STRONG;  else Info[1] =WEAK; } Let PtrImage[0] be the left-top pixel of current 4×4 block andwidth be the picture width. if (Info[0] == STRONG && Info[1] == STRONG){ for(m=0; m<4; m++) { o[0]=Ptrlmg[−4]; o[1]=PtrImg[−3];o[2]=PtrImg[−2]; o[3]=PtrImg[−1]; o[4]=Ptrlmg[0]; o[5]=PtrImg[1];o[6]=PtrImg[2]; o[7]=PtrImg[3]; PtrImg[−2] =(o[0]+2*o[1]+2*o[2]+2*o[3]+o[4]+4)/8;  PtrImg[−1] =(o[1]+2*o[2]+2*o[3]+2*o[4]+o[5]+4)/8;  PtrImg[0] =(o[2]+2*o[3]+2*o[4]+2*o[5]+o[6]+4)/8;  PtrImg[1] =(o[3]+2*o[4]+2*o[5]+2*o[6]+o[7]+4)/8;

According to the above source code, it is possible to check if an edgeregion is present in a block and more precisely detect the presence ofan edge region in a block by a comparison of filter information betweenadjacent blocks.

While the present invention has been particularly shown and describedwith reference to preferred embodiments thereof, it will be understoodby those skilled in the art that various changes in form and details maybe made therein without departing from the spirit and scope of theinvention as defined by the appended claims.

As described above, in a filtering method and apparatus according to thepresent invention, blocking artifacts and/or ringing noise can beremoved by more effectively detecting an edge region.

1. A method for encoding video frames, comprising: (a) generatingfiltering information of a present block based on transformed andquantized coefficients of the present block and a neighboring block ofthe present block; (b) setting a filter characteristic of the presentblock based on the filtering information; (c) inputtingmotion-compensated pixel values of the present block into a filteringunit; and (d) performing adaptive filtering by outputting filtered pixelvalues for a predetermined-number of pixel values among the inputtedmotion-compensated pixel values based on the filter characteristic,wherein the filtering unit is in a feedback path to use the filteredpixel values for encoding a next block.
 2. The method of claim 1,wherein (a) further comprises: (a1) performing DCT and quantization on apixel not corresponding to a DC component, in an uppermost row and aleftmost column of the block to obtain a quantized DCT coefficient; and(a2) checking the DCT coefficient, creating the filter information basedon the checked result when the quantized DCT coefficient is a valueother than 0, and terminating performing DCT and quantization on pixelsin the uppermost row and leftmost column.
 3. The method of claim 2,wherein (a) further comprises: (a3) checking the quantized DCTcoefficient, and performing DCT and quantization on a pixel notcorresponding to the DC component, in the uppermost row and leftmostcolumn when the quantized DCT coefficient is 0; (a4) repeatedlyperforming (a2) and (a3) on remaining pixels not corresponding to the DCcomponent and the one pixel, in the uppermost row and leftmost column soas to obtain quantized DCT coefficients; and (a5) creating filterinformation when the quantized DCT coefficients for all the pixels inthe uppermost row and leftmost column are
 0. 4. An encoder for encodingvideo frames, comprising: loop filter unit generating filteringinformation of a present block based on transformed and quantizedcoefficients of the present block and a neighboring block of the presentblock, setting a filter characteristic of the present block based on thefiltering information, and performing an adaptive filtering byoutputting filtered pixel values for a predetermined-number of pixelvalues among inputted motion-compensated pixel values based on thefilter characteristic, wherein the loop filter unit is in a feedbackpath to use the filtered pixel values for encoding a next block.
 5. Theapparatus of claim 4, wherein the loop filtering unit is characterizedby performing DCT and quantization on a pixel not corresponding to a DCcomponent, in an uppermost row and a leftmost column of the block toobtain a quantized DCT coefficient and checking the DCT coefficient,creating the filter information based on the checked result when thequantized DCT coefficient is a value other than 0, and terminatingperforming DCT and quantization on pixels in the uppermost row andleftmost column.
 6. The apparatus of claim 5, wherein the loop filteringunit is characterized by checking the quantized DCT coefficient, andperforming DCT and quantization on a pixel not corresponding to the DCcomponent, in the uppermost row and leftmost column when the quantizedDCT coefficient is 0, repeatedly performing to check the DCTcoefficients on remaining pixels not corresponding to the DC componentand the one pixel, in the uppermost row and leftmost column so as toobtain quantized DCT coefficients; and creating filter information whenthe quantized DCT coefficients for all the pixels in the uppermost rowand leftmost column are
 0. 7. A method for decoding video frames,comprising: (a) generating filtering information of a present blockbased on transformed and quantized coefficients of the present block anda neighboring block of the present block; (b) setting a filtercharacteristic of the present block based on the filtering information;(c) inputting motion-compensated pixel values of the present block intoa filtering unit; and (d) performing adaptive filtering by outputtingfiltered pixel values for a predetermined-number of pixel values amongthe inputted motion-compensated pixel values based on the filtercharacteristic, wherein the filtering unit is in a feedback path to usethe filtered pixel values for decoding a next block.
 8. The method ofclaim 7, wherein (a) further comprises: (a1) performing DCT andquantization on a pixel not corresponding to a DC component, in anuppermost row and a leftmost column of the block to obtain a quantizedDCT coefficient; and (a2) checking the DCT coefficient, creating thefilter information based on the checked result when the quantized DCTcoefficient is a value other than 0, and terminating performing DCT andquantization on pixels in the uppermost row and leftmost column.
 9. Themethod of claim 8, wherein (a) further comprises: (a3) checking thequantized DCT coefficient, and performing DCT and quantization on apixel not corresponding to the DC component, in the uppermost row andleftmost column when the quantized DCT coefficient is 0; (a4) repeatedlyperforming (a2) and (a3) on remaining pixels not corresponding to the DCcomponent and the one pixel, in the uppermost row and leftmost column soas to obtain quantized DCT coefficients; and (a5) creating filterinformation when the quantized DCT coefficients for all the pixels inthe uppermost row and leftmost column are
 0. 10. A decoder for decodingvideo frames, comprising: loop filter unit generating filteringinformation of a present block based on transformed and quantizedcoefficients of the present block and a neighboring block of the presentblock, setting a filter characteristic of the present block based on thefiltering information, and performing an adaptive filtering byoutputting filtered pixel values for a predetermined-number of pixelvalues among inputted motion-compensated pixel values based on thefilter characteristic, wherein the loop filter unit is in a feedbackpath to use the filtered pixel values for decoding a next block.
 11. Theapparatus of claim 10, wherein the loop filtering unit is characterizedby performing DCT and quantization on a pixel not corresponding to a DCcomponent, in an uppermost row and a leftmost column of the block toobtain a quantized DCT coefficient and checking the DCT coefficient,creating the filter information based on the checked result when thequantized DCT coefficient is a value other than 0, and terminatingperforming DCT and quantization on pixels in the uppermost row andleftmost column.
 12. The apparatus of claim 11, wherein the loopfiltering unit is characterized by checking the quantized DCTcoefficient, and performing DCT and quantization on a pixel notcorresponding to the DC component, in the uppermost row and leftmostcolumn when the quantized DCT coefficient is 0, repeatedly performing tocheck the DCT coefficients on remaining pixels not corresponding to theDC component and the one pixel, in the uppermost row and leftmost columnso as to obtain quantized DCT coefficients; and creating filterinformation when the quantized DCT coefficients for all the pixels inthe uppermost row and leftmost column are 0.